package mt.dummy;

import java.io.Serializable;

import mt.Order;
import mt.comm.ClientSideMessage;
/**
 * ClientMessage are the messages sent from clients to the server.
 * @author Pedro, Rita,Miguel
 *
 */


public class ClientMessage implements ClientSideMessage, Serializable{
	/**
	  * The type of the Message. It may be: ORDER, ERROR  */

	
	private Type type;
	
	/**
	  * The error of the message (it is a sentence with the error).
	  */

	private String error;
	
	/**
     * The order of the message.
     */

	private Order order;

/**
 * Constructor. Constructs a message contains a type (enum), and, if the type is ERROR, an error message (a String).  
 * @param type
 * @param error
 */
	
	public ClientMessage(Type type, String error){
			this.type=type;
			this.error=error;
	}
	
/**
 * Constructor. Constructs a message contains a type (enum), and, if the type is ORDER, an {@link mt.Order}
 * @param type
 * @param order
 */
	public ClientMessage(Type type, Order order){
		this.type=type;
		this.order=order;
	}

	@Override
	public Type getType() {
		// TODO Auto-generated method stub
		return type;
	}

	@Override
	public Order getOrder() {
		// TODO Auto-generated method stub
		return order;
	}

	@Override
	public String getError() {
		// TODO Auto-generated method stub
		return error;
	}
}